Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configurable client signing algorithms #1517

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

tetsuo-cpp
Copy link

@tetsuo-cpp tetsuo-cpp commented Jan 8, 2024

Summary

This PR adds a --client-signing-algorithms flag to Fulcio to restrict what key/hash combinations are allowed.

Release Note

Documentation

Signed-off-by: Alex Cameron <asc@tetsuo.sh>
Signed-off-by: Alex Cameron <asc@tetsuo.sh>
@tetsuo-cpp tetsuo-cpp marked this pull request as draft January 8, 2024 11:21
@tetsuo-cpp
Copy link
Author

tetsuo-cpp commented Jan 8, 2024

@woodruffw @ret2libc
As discussed, this is rough but I've opened it up for discussion since it probably makes sense to share some of this logic with Rekor. I haven't written Go before so please let me know if I'm not doing things idiomatically, I don't really know what I'm doing.

pkg/server/algorithm_registry.go Outdated Show resolved Hide resolved
pkg/server/grpc_server.go Show resolved Hide resolved
pkg/server/algorithm_registry.go Outdated Show resolved Hide resolved
Signed-off-by: Alex Cameron <asc@tetsuo.sh>
@tetsuo-cpp
Copy link
Author

I've shown in d95ff74 how we can use an enum in sigstore/protobuf-specs to avoid redundancy in Fulcio and Rekor in CLI parsing, etc.

go.mod Outdated Show resolved Hide resolved
cmd/app/serve.go Outdated Show resolved Hide resolved
pkg/server/grpc_server.go Show resolved Hide resolved
pkg/server/grpc_server.go Show resolved Hide resolved
pkg/server/grpc_server.go Show resolved Hide resolved
pkg/server/grpc_server.go Show resolved Hide resolved
@woodruffw
Copy link
Member

xref: sigstore/protobuf-specs#189 will ultimately standardize the full registry of signing algorithms, but doesn't block initial work here (since we know a couple of ECDSA variants that'll need verification support already).

Signed-off-by: Alex Cameron <asc@tetsuo.sh>
@tetsuo-cpp
Copy link
Author

I'll follow up with some unit tests tomorrow.

Signed-off-by: Alex Cameron <asc@tetsuo.sh>
Signed-off-by: Alex Cameron <asc@tetsuo.sh>
Signed-off-by: Alex Cameron <asc@tetsuo.sh>
@@ -106,6 +109,7 @@ func newServeCmd() *cobra.Command {
cmd.Flags().Duration("read-header-timeout", 10*time.Second, "The time allowed to read the headers of the requests in seconds")
cmd.Flags().String("grpc-tls-certificate", "", "the certificate file to use for secure connections - only applies to grpc-port")
cmd.Flags().String("grpc-tls-key", "", "the private key file to use for secure connections (without passphrase) - only applies to grpc-port")
cmd.Flags().StringSlice("client-signing-algorithms", buildDefaultClientSigningAlgorithms([]v1.KnownSignatureAlgorithm{v1.KnownSignatureAlgorithm_ECDSA_SHA2_256_NISTP256, v1.KnownSignatureAlgorithm_ECDSA_SHA2_384_NISTP384, v1.KnownSignatureAlgorithm_ECDSA_SHA2_512_NISTP521, v1.KnownSignatureAlgorithm_ED25519}), "the list of allowed client signing algorithms")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we default to the 256 algos only right now? I think that's the most conservative option as it does not add new algos. Other SHAs were not working before.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering the same for Rekor as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I think that'd be a reasonable default.

@@ -1182,6 +1188,94 @@ func TestAPIWithIssuerClaimConfig(t *testing.T) {
}
}

// Tests API with an RSA key
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to unit test the algorithm registry code too heavily here since that's sigstore/sigstore's responsibility.

I'm focusing on:

  • Testing that other key types work (RSA in this case).
  • Testing that non-permitted algorithms are rejected (ECDSA with P521 curve in this case).
  • Testing both the CSR and non-CSR paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants